using System;
using System.Collections.Generic;
using UnityEngine;

[Serializable]
public abstract class TTCameraBehaviour
{
	public enum GameplayIntervalType
	{
		ServeCamera = 0,
		ReceiveServeCamera = 1,
		RegularPlayCamera = 2,
		FlyAroundCourtCamera = 3,
		BallHitNet = 4,
		BallHitMiss = 5,
		BallMissTable = 6,
		BallHitFloor = 7,
		WinShot = 8,
		None = 9,
		OpponentReceiveBallCamera = 10,
		IntroCameraLeft = 11,
		IntroCameraRight = 12,
		RacketCamera = 13,
		IntroCamera = 14
	}

	public GameplayIntervalType gameIntervalType;

	public List<GameplayIntervalType> additionalTypes = new List<GameplayIntervalType>();

	public List<CameraBehavioursDB.CameraGroupType> supportedGroups = new List<CameraBehavioursDB.CameraGroupType>();

	public float moveSpeed = 4f;

	public float rotationSpeed = 4f;

	public float fov = 50f;

	protected Camera camera;

	protected TTCameraController cameraController;

	protected TTCameraOptions cameraOptions;

	public bool IsGameIntervalSupported(GameplayIntervalType type)
	{
		if (gameIntervalType == type)
		{
			return true;
		}
		foreach (GameplayIntervalType additionalType in additionalTypes)
		{
			if (additionalType == type)
			{
				return true;
			}
		}
		return false;
	}

	public bool IsGroupSupported(CameraBehavioursDB.CameraGroupType groupType)
	{
		foreach (CameraBehavioursDB.CameraGroupType supportedGroup in supportedGroups)
		{
			if (supportedGroup == groupType)
			{
				return true;
			}
		}
		return false;
	}

	public virtual void Start(Camera cam, TTCameraController camController, TTCameraOptions cameraOptions)
	{
		camera = cam;
		cameraController = camController;
		this.cameraOptions = cameraOptions;
	}

	public virtual void Update()
	{
	}

	public virtual void OnEnd()
	{
		if (cameraOptions.player != null && !cameraOptions.player.match.starter.paused)
		{
			Time.timeScale = cameraOptions.player.match.starter.timeScale;
		}
	}

	protected virtual Quaternion DesiredRotation()
	{
		return Quaternion.identity;
	}

	protected virtual Vector3 DesiredPosition()
	{
		return Vector3.zero;
	}
}
